package crudfx.util;
import javafx.scene.*;
import javafx.scene.image.*;
/**
 * @profile desktop
 * @author Sergey Surikov
 */
public class BackgroundImage extends CustomNode{
    public var image:Image;
    public var width:Number;
    public var height:Number;
    public override function create(): Node {
        def ratio=bind image.width / image.height;
        return ImageView {
            fitWidth: bind
                if(width / height > ratio) width else 0;
            fitHeight: bind
                if(width / height <= ratio) height else 0;
            preserveRatio: true
            image: image
        };
    }
}
